package cn.com.lushunming.springsecuritydemo.controller;

import lombok.extern.log4j.Log4j2;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * index controller
 */

@Controller
@RequestMapping("index")
@Log4j2
public class IndexController {
    @RequestMapping("")
    public String index() {
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        log.info("principal:{}", principal);
        return "index";
    }
}
